import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * The class snail is a enemy that will move slow in the scenario. 
 * 
 * @author Manuel Nava
 * @version 1.0
 */
public class Snail extends Enemy
{
    private int contMov;
    
    /**
     * The constructor of this class sets the movement counter to zero.
     */
    public Snail()
    {
        contMov=0;
    }
    
    /**
     * The method act calls the method move and the superclass method death.
     */
    public void act() 
    {
        move();
        super.death();
    }

    /**
     * The method move moves the object decrementing his x position as long as the movement counter gets to 20 
     * or more. Too calls the method move of the superclass.
     */
    public void move()
    {
        if(contMov<20)
                contMov++;
        if(contMov>=20)
        { 
            if(getX()>0)
            setLocation(getX()-2,getY()); 
            contMov=0;
        }
        super.move();
    }

}
